﻿#ifndef DECLARATIONMANAGER_H
#define DECLARATIONMANAGER_H

#include <string>
#include <unordered_map>

class Node;

class DeclarationManager
{
    using NodeMap = std::unordered_map<std::string, const Node*>;

    DeclarationManager();
    ~DeclarationManager();
    bool parseType(const std::string &definition_file, const std::string &type_name) const;
    void destroyTypes();

    mutable NodeMap m_node_map;
    std::string     m_type_lib;
public:
    DeclarationManager(const DeclarationManager&) = delete;
    DeclarationManager(DeclarationManager&&) = delete;

    bool initDeclarationLibPath(const std::string &library_dir);
    const Node *findNodeDeclaration(const std::string &node_id) const;
    bool validationXmlScript(const std::string &file_path, std::ostream &out_info);

    static DeclarationManager& getInstance();
};

#endif // DECLARATIONMANAGER_H
